﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NabNetLib.Packet;


namespace NabNetLib
{
    public partial class Lapin
    {
        

        // Called when the bunny is requesting init packet (during boot)
        public byte[] GetInitPacket()
        {
            // Create minimal packet
            AmbientPacket a = new AmbientPacket(AmbientServiceType.ServiceNose, (byte) NoseValues.NoseNo);
            a.SetEarsPosition(0, 0);

            SleepPacket s = new SleepPacket(SleepState.WakeUp);

            // Pass AmbientPacket to all bunny's plugins
            //foreach(PluginInterface * p, listOfPluginsPtr)
            //{
            //    if(p->GetEnable())
            //        p->OnInitPacket(this, a, s);
            //}

            // Create packetList and return packet's data
            List<Packet.Packet> l = new List<Packet.Packet>();
            l.Add(a);
            l.Add(s);

            return Packet.Packet.GetData(l);
        }

        public LapinState State { get; set; }

        public IEnumerable<Plugin> Plugins
        {
            get 
            { 
                return (from p in this.Lapin2Plugin select p.Plugin);
            }
        }

        public string XmppResource { get; set; }
    }

    public enum LapinState
    {
        Booting, Ready, Sleeping
    }

    
    
}
